package com.tecode.myBooks.user.servlet;

import com.tecode.myBooks.user.service.UserService;
import com.tecode.myBooks.user.service.impl.UserServiceImpl;

import javax.servlet.*;
import java.io.IOException;

/**
 * Created by Administrator on 2018/11/21.
 */
public class UserPhoneSend implements Servlet {
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
            //获得手机号码参数
        String phone =request.getParameter("phone");

        System.out.println(phone);


        UserService userService = new UserServiceImpl();
        //进行短信发送的业务
       String result = userService.smsSend(phone);

        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html");
        response.getWriter().print(result);
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
